<meta charset="UTF-8" />
<title>imageToFile</title>

<script type="module">

import Base64Util from "../utils/convert/base64-util.js";
import readFile from "../utils/read/read-file.js";
import blobToFile from "../utils/convert/blob-to-file.js";
import downloadFile from "../utils/download/download-file.js";

window.onload = async function () {
    const imageFile = await readFile("../assets/images/测试图片.png");
    const imageName = imageFile.name;
    const imageBase64Str = await Base64Util.parseBlob(imageFile);
    const image = await Base64Util.toImage(imageBase64Str);
    document.body.appendChild(image);
    const file = blobToFile(imageName, Base64Util.toBlob(imageBase64Str));
    downloadFile(file);
};

</script>
